-
Notifications
You must be signed in to change notification settings - Fork 1k
Refactor hyperdrive create and update commands to match each other's behavior and address bug with individual parameters on creation #7024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 0db8edf The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
||
| export type OriginHoA = OriginCommon & { | ||
| access_client_id: string; | ||
| access_client_secret?: never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the base OriginHoA include the secrets, when we have a WithSecrets version, seems wrong to me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OriginHoA is actually enforcing that the secret is not present here, this type is saying "access_client_secret" must never be set.
| port?: never; | ||
| }; | ||
|
|
||
| export type OriginHostAndPort = OriginCommon & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SQC-Config, the "HostAndPort" naming convention is what we use for non-HoA configs. Having the HoA-specific fields here seems wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is doing the same thing as OriginHoA, instead enforcing that the HoA fields are not present
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-wrangler-7024You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7024/npm-package-wrangler-7024Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-wrangler-7024 dev path/to/script.jsAdditional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-create-cloudflare-7024 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-kv-asset-handler-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-miniflare-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-pages-shared-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-vitest-pool-workers-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-workers-editor-shared-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-workers-shared-7024npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11572515343/npm-package-cloudflare-workflows-shared-7024Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
|
Overall I love the refactor, much cleaner and should be way easier to maintain going forward. I just think the ClientType names and contents need a once-over to align with the config service a bit more. |
d6eabca to
da3efac
Compare
|
Looks good to me from the Hyperdrive Team side of things. |
emily-shen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are also currently failing - think its just test snapshots need to be updated though (run them locally and press u)
| throw new UserError( | ||
| "You must provide a password - e.g. 'user:[email protected]:port/databasename' " | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally the user doesn't have to incrementally fix things and get new error messages each time - can you run all these checks and list all errors once at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some arguments like --port where you need to provide --port OR --access-client-id and --access-client-secret that makes doing that complex, and I don't think there will be an improvement in user experience that justifies the work required as a result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wont block on this, but for future reference, in the same place where you currently throw you can push the error messages to an array, then join them back up and throw once after the if/else checks :)
| if (!args.originScheme || args.originScheme === "") { | ||
| throw new UserError( | ||
| "You must specify the database protocol as --origin-scheme - e.g. 'postgresql'" | ||
| ); | ||
| } else if (!args.database || args.database === "") { | ||
| throw new UserError("You must provide a database name"); | ||
| } else if (!args.originUser || args.originUser === "") { | ||
| throw new UserError( | ||
| "You must provide a username for the origin database" | ||
| ); | ||
| } else if (!args.originPassword || args.originPassword === "") { | ||
| throw new UserError( | ||
| "You must provide a password for the origin database" | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also check if all the required args are present and error once with all the missing args
…behavior and address bug with individual parameters on creation
da3efac to
3589173
Compare
What this PR solves / how to test
Fixes SQC-338
Author has addressed the following